package yto.freemarker.springbootstudy.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yto.freemarker.springbootstudy.entity.App;
import yto.freemarker.springbootstudy.mapper.AppMapper;

/**
 * 使用swagger
 *
 * @author dongxing
 * @create 2018-04-09 14:50
 **/
@Api(value = "demo演示",description = "这个controller是干嘛的")
@RestController
@AllArgsConstructor(onConstructor = @_(@Autowired))
@RequestMapping("/app")
public class SwaggerController {

    private final AppMapper appMapper;


    @ApiOperation(value = "通过id查询用户的信息",notes = "详细注释")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path",name = "id",dataType = "Integer",required = true,value = "用户的id")})
    @GetMapping("/{id}")
    public App getHello3(@PathVariable Integer id/*, HttpServletResponse response*/) {
//        response.setContentType("text/html;charset=utf-8");
        App app = appMapper.selectByPrimaryKey(id);
        return app;
    }
}
